#Demo difference between gcc/g++ options: 
#-g: produce debug info for gdb, etc.
#-O0 -O2 -O3: level of optimize codes, this takes effect on inline functions when gdb. You can't set breakpoints on inline functions when -O2 is used, whereas OK for -O0.
targetFile=main

.PHONY: clean run

$(targetFile): $(targetFile).cc
	g++ $(targetFile).cc -o $(targetFile) #This can't be debuged using gdb since no debug info is added for debugger.
	g++ $(targetFile).cc -g -o $(targetFile).debug #This can be debuged using gdb since debug info is added for debugger.
	g++ $(targetFile).cc -g -O0 -o $(targetFile).debug.O0 #This can be debuged using gdb since debug info is added for debugger. More, can set break points on inline functions.
	g++ $(targetFile).cc -g -O1 -o $(targetFile).debug.O1 #This can be debuged using gdb since debug info is added for debugger. 
	g++ $(targetFile).cc -g -O2 -o $(targetFile).debug.O2 #This can be debuged using gdb since debug info is added for debugger. But can't set break points on inline functions.

run:
	gdb $(targetFile).debug.O0

clean:
	rm -f $(targetFile) $(targetFile).debug*
